import { pageDiagnosisPatients } from "@/api/ImmigrationDictionary";
import { BasicColumn, BasicTable, FormSchema, useRender, useTable } from "@/components/Table";
import { useTranslation } from "react-i18next";

export default function index() {
	const { t } = useTranslation();

	const columns: BasicColumn[] = [
		{
			title: t("Immigration.stt"),
			dataIndex: "index",
			render: (_, __, index) => index + 1
		},
		{
			title: t("patientBasic.patient_code"),
			dataIndex: "patCardno"
		},
		{
			title: t("patientBasic.full_name"),
			dataIndex: "fullName",
			render: (_, record) => (record.patients ? record.patients.fullName : "")
		},
		{
			title: t("patientBasic.birthyear"),
			dataIndex: "birthday",
			render: (_, record) => (record.patients ? record.patients.birthday : "")
		},
		{
			title: t("patientBasic.pat_address"),
			dataIndex: "address"
		},
		{
			title: t("patientBasic.occupation"),
			dataIndex: "occupation",
			render: (_, record) => (record.patients ? record.patients.occupation : "")
		},
		{
			title: t("kevin_ui.admission_date"),
			dataIndex: "admissionDate",
			render: (_, record) => (record.admissions ? useRender.renderDate(record.admissions.dateAdmission) : "")
		},
		{
			title: t("kevin_ui.icd_code"),
			dataIndex: "icd_code"
		},
		{
			title: t("kevin_ui.diagnosis"),
			dataIndex: "diagnosis"
		},
		{
			title: t("kevin_ui.doctor"),
			dataIndex: "doctorName"
		},
		{
			title: t("kevin_ui.admission_number"),
			dataIndex: "admission_number"
		},
		{
			title: t("kevin_ui.department"),
			dataIndex: "deptName"
		},
		{
			title: t("patientBasic.pat_type"),
			dataIndex: "patientType"
		}
	];
	const searchFormSchema_II: FormSchema[] = [
		{
			label: t("kevin_ui.from_date"),
			field: "from_date",
			component: "DatePicker"
		},
		{
			label: t("kevin_ui.to_date"),
			field: "to_date",
			component: "DatePicker"
		},
		{
			label: "Subject",
			field: "Subject",
			component: "Select"
		},
		{
			label: "Non- referral",
			field: "Non- referral",
			component: "Select"
		},
		{
			label: "Referral letter",
			field: "Referral letter",
			component: "Select"
		},
		{
			label: t("patientBasic.patient_id"),
			field: "patientId",
			component: "Select"
		},
		{
			label: t("patientBasic.full_name"),
			field: "fullName",
			component: "Select"
		},
		{
			label: t("patientBasic.birthyear"),
			field: "birthday",
			component: "Select"
		},
		{
			label: t("patientBasic.pat_type"),
			field: "patType",
			component: "Select"
		},
		{
			label: t("patientBasic.age"),
			field: "age",
			component: "Select"
		},
		{
			label: t("patientBasic.gender"),
			field: "gender",
			component: "Select"
		},
		{
			label: t("patientBasic.pat_address"),
			field: "address",
			component: "Select"
		},
		{
			label: t("patientBasic.occupation"),
			field: "occupation",
			component: "Select"
		},
		{
			label: t("patientBasic.ethnicity"),
			field: "ethnicity",
			component: "Select"
		},
		{
			label: "Salary Level",
			field: "Salary Level",
			component: "Select"
		},
		{
			label: "Admission Number",
			field: "Admission Number",
			component: "Select"
		},
		{
			label: "ICD Code",
			field: "ICD Code",
			component: "Select"
		},
		{
			label: "Direct Admission",
			field: "Direct Admission",
			component: "Select"
		},
		{
			label: "Referral from",
			field: "Referral from",
			component: "Select"
		},
		{
			label: "Importer",
			field: "Importer",
			component: "Select"
		}
	];
	const [patServicesTable] = useTable({
		api: pageDiagnosisPatients,
		columns,
		useSearchForm: true,
		formConfig: {
			labelWidth: 120,
			schemas: searchFormSchema_II,
			showActionButtonGroup: true,
			baseColProps: { span: 6 }
		}
	});

	return (
		<div className="page51401">
			<div className="page-content">
				<BasicTable register={patServicesTable}></BasicTable>
			</div>
		</div>
	);
}
